import { Pipe, PipeTransform } from '@angular/core';
const HUNDRED_MILLION = 100000000;
@Pipe({
  name: 'withHundredMillion',
})
export class WithHundredMillionPipe implements PipeTransform {
  /**
   * @param count
   * @description: 过亿转成 'x.1️x亿' 保留两位小数
   */
  transform(count: number): string | number {
    if (count > HUNDRED_MILLION) {
      const num = (count / HUNDRED_MILLION).toFixed(2);
      return `${num}亿`;
    }
    return count;
  }
}
